//@author A0083782W
//This file is the communication of the UserCommand class and Operation class.
// The duo share their enum and constants here.

#pragma once

#include "ConstantList.h"
#include <vector>
#include "EventTime.h"

using std::vector;
using TimeConstants::WeekDay;

enum class OperationType {
	UNCLEAR = 0,
	ADD = 1,
	DELETE_BY_NUMBER = 2,
	MODIFY = 3,
	SEARCH = 4,
	UNDO = 5,
	
	HELP = 6,
	CONFIG = 7,
	MARK = 8,
	EXIT = 9,
	CLEAR = 10,
	SAVEFILE = 11,
	DELETE_BY_EVENT,
};

con_str WRITE_TO_FILE = "write";
con_str READ_FROM_FILE = "read";

const pos_int DURATION_CONSTANT = 2;

enum class Expection {
	NORMAL = 0,
    CONFIG_STEP2 = 3,//ooooo
    CONFIG_STEP3 = 4,    
};

enum class RepeatFrequency{
	NO_REPEAT = 0,
	EVERY_N_DAY = 1,
	EVERY_MONTH = 2,
};

struct REPEAT_RULE {
	RepeatFrequency frequency;
	WeekDay startOfWeek;
	pos_int period;
	void reset();
	bool operator == (const REPEAT_RULE& rightOperand) const;
};

enum class SearchFilter {
	NORMAL = 0,
	ANYTHING,
	REMINDED,
	NOT_REMINDED,
	DONE,
	NOT_DONE ,
	FLOATING ,
	NOT_FLOATING,
	REPEATABLE,
	NOT_REPEATABLE,
	MISSED,
	NOT_MISSED,
	FAVOURITE,
	NOT_FAVOURITE,
};

enum class MarkFilter {
	UNCLEAR = 0,
	DONE,
	NOT_DONE,
	REMINDED,
	NOT_REMINDED,
	MISSED,
	NOT_MISSED,
	FAVOURITE,
	NOT_FAVOURITE,
};

//@author A0101056Y
struct SEARCH_STRUCT {
	string messages;
	Time beginTime;
	Time endTime;
	vector<string> tags;
	vector<SearchFilter> filters;
	void reset();
};

struct SEARCH_RELEVANCE {
	pos_int storageIndex;
	signed long long int relevanceIndex;
};

struct SORT_STRUCT {
	pos_int storageIndex; 
	Time startTime;
	string description;
};

//@author A0083782W
struct MARK_STRUCT {
	vector<pos_int> IDs;
	vector<MarkFilter> filters;
	void reset();
};

enum class ModifyType {
	END = 0,
	DETAIL = 1,
	TIME = 2,
	REPEATRULE = 3,
	REMIND_TIME = 4,
	TAGS = 5,
	UNCLEAR = 6,
};

enum class Config_Type {
	UNCLEAR = 0,
	DATE,
	TIME,
	ORDER,
};

struct MODIFY_STRUCT {
	vector<pos_int> IDs;
	vector<string> modifyInfo;
	void reset();
	MODIFY_STRUCT();
};


enum class CurrentTabs {
	CONSOLE = 0, 
	TODAY, 
	MISSED, 
	FAVORITE,
	FLOATING,
	WRONG,
};

enum class IllegalInput
{
	//This is the default status, means the user's last input is all correct
	NO_PROBLEM = 0,

	//The user just input some random rubbish
	UNKNOW_CHARACTERS,

	//The user never input any filter for mark action
	MARK_NO_FILTER,

	//The user has put in too many parameters for the add keyword
	ADD_TOO_MANY_PARAMETERS ,

	//The user never add a description of the task
	ADD_NO_TASK_DESCIPTION ,

	//The user input an illegal string for delete, like "delete 1 to a"
	DELETE_ILLEGAL_PARAMETER , 

	//The user input an illegal string for modify, like "modify     "
	MODIFY_NO_INDEX,

	MARK_NO_INDEX,

	//The user input illegal flags when searching
	SEARCH_ILLEGAL_FLAGS,

	//passing an unknow string as a parameter to undo command
	UNDO_ILLEAGAL_NUMBER
};
